﻿using System.Collections.Generic;
using CardPlay.Model.CardModel;
using CardPlay.Model.GameModel;
using CardPlay.Model.GameModel.Presentation;
using CardPlay.Model.Layout;

namespace CardPlay.DemoPack.Games.PairingVariants
{
    [Game("167CD6C4-D3FA-4186-AC56-BE5AA5998366", LevelOfDifficulty.Easy, LevelOfSkill.ChanceOnly, DurationOfPlay.LessThan5Minutes, Family = FamilyName)]
    public class Wish : PairingStyleGame
    {
        public Wish()
        {
            TotalTableaus = 8;
        }

        protected override bool IsOver
        {
            get { return !SetHasPair(this.NonEmptyPilesNamed(AnyTableau)); }
        }

        public override ILayoutSite CreatePresentation(IPresentationContext presentation)
        {
            var root = presentation.CreateRowLayout();
            presentation.AddPiles(root, NamesOfTableaus, new VisualTraits { Arrangement = CardArrangement.StackSquare, ContentFit = ContentFit.FitBounds });

            return root;
        }

        protected override IEnumerable<Card> CardsInInitialDeal
        {
            get { return DeckFactory.CreateStrippedDeck(face => face.Rank == Rank.Ace || face.Rank >= Rank.Seven); }
        }

        protected override void PrepareDealScript(DealScript script)
        {
            script.DealToEach(NamesOfTableaus, "4 up");
        }
    }
}